package com.woniuxy.three.pms.hotel1.controller;
import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.woniuxy.three.pms.bean.GuestBean;
import com.woniuxy.three.pms.hotel1.service.IGuestSevice;
	
@Controller
public class GuestController {
@Autowired
private IGuestSevice GuestServiceImpl;

public void setGuestServiceImpl(IGuestSevice guestServiceImpl) {
	GuestServiceImpl = guestServiceImpl;
}

@PostMapping(value ="/guest/insert")
@ResponseBody
public int insertGuest(@Validated GuestBean bean,Model model) {
	model.addAttribute(bean);
	return GuestServiceImpl.addGuest(bean);
	
}

@DeleteMapping(value ="/guest/del")
@ResponseBody
public boolean delGuest(String idcard) {
	return GuestServiceImpl.delGuestByidCard(idcard);
}
@PutMapping(value ="/guest/update")
@ResponseBody
public boolean update(String status,String idcard) {
	return GuestServiceImpl.updateGuest(status,idcard);
}
@GetMapping(value = "/guest/show")
@ResponseBody
public PageInfo<GuestBean> showGuestBeans(int pageNo,int pageSize ){
	return GuestServiceImpl.showGuest(pageNo, pageSize);
}
}
